var unixtime = 1358932051;
function timestamp2data(time)
{
    let unixtime = time
    let unixTimestamp = new Date(unixtime * 1000)
    let Y = unixTimestamp.getFullYear()
    let M = ((unixTimestamp.getMonth() + 1) > 10 ? (unixTimestamp.getMonth() + 1) : '0' + (unixTimestamp.getMonth() + 1))
    let D = (unixTimestamp.getDate() > 10 ? unixTimestamp.getDate() : '0' + unixTimestamp.getDate())
    let toDay = Y + '-' + M + '-' + D
    return toDay
}


function data2stamp(data){
    return (new Date(Date.parse(data.replace(/-/g, "/"))).getTime())/1000;
}
let data1="2012-02-16 12:11:11";
console.log(data2stamp(data1));
data

// console.log(formatTime(unixtime));